home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Prg / LED102.ZIP / LEDTEST.FRM < prev    next >
Text File  |  1997-09-14  |  15KB  |  528 lines

  1. VERSION 2.00
  2. Begin Form ledtest 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "LED Examples"
  5.    ClientHeight    =   4635
  6.    ClientLeft      =   1290
  7.    ClientTop       =   2100
  8.    ClientWidth     =   8460
  9.    Height          =   5010
  10.    Left            =   1245
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   8.176
  13.    ScaleMode       =   0  'User
  14.    ScaleWidth      =   14.923
  15.    Top             =   1770
  16.    Width           =   8550
  17.    Begin CommandButton Command1 
  18.       Caption         =   "&VBX Info"
  19.       Height          =   495
  20.       Left            =   6570
  21.       TabIndex        =   22
  22.       Top             =   3900
  23.       Width           =   1755
  24.    End
  25.    Begin Frame Frame4 
  26.       BackColor       =   &H00C0C0C0&
  27.       Caption         =   "Max Decay Ex."
  28.       Height          =   3375
  29.       Left            =   6600
  30.       TabIndex        =   16
  31.       Top             =   330
  32.       Width           =   1695
  33.       Begin LED LED5 
  34.          AutoSize        =   -1  'True
  35.          BackColor       =   &H00C0C0C0&
  36.          BevelInner      =   0  ' 0 - None
  37.          BevelOuter      =   0  ' 0 - None
  38.          BevelWidth      =   2
  39.          BorderHorizontal=   2
  40.          BorderVertical  =   2
  41.          BorderWidth     =   2
  42.          DecayRate       =   50
  43.          Direction       =   1  ' 1 - Backward
  44.          Height          =   3000
  45.          Index           =   3
  46.          LEDHeight       =   6
  47.          LEDIndex        =   0
  48.          LEDSep          =   0
  49.          LEDStyle        =   0  ' 0 - Rectangular
  50.          LEDWidth        =   15
  51.          Left            =   1050
  52.          MaxDecay        =   -1  'True
  53.          Mode            =   0  ' 0 - Value
  54.          MouseControl    =   0   'False
  55.          NumLEDs         =   32
  56.          Orientation     =   1  ' 1 - Vertical
  57.          TabIndex        =   20
  58.          Top             =   330
  59.          Value           =   0
  60.          Width           =   345
  61.       End
  62.       Begin LED LED5 
  63.          AutoSize        =   -1  'True
  64.          BackColor       =   &H00C0C0C0&
  65.          BevelInner      =   0  ' 0 - None
  66.          BevelOuter      =   0  ' 0 - None
  67.          BevelWidth      =   2
  68.          BorderHorizontal=   2
  69.          BorderVertical  =   2
  70.          BorderWidth     =   2
  71.          DecayRate       =   50
  72.          Direction       =   1  ' 1 - Backward
  73.          Height          =   3000
  74.          Index           =   2
  75.          LEDHeight       =   6
  76.          LEDIndex        =   0
  77.          LEDSep          =   0
  78.          LEDStyle        =   0  ' 0 - Rectangular
  79.          LEDWidth        =   15
  80.          Left            =   780
  81.          MaxDecay        =   -1  'True
  82.          Mode            =   0  ' 0 - Value
  83.          MouseControl    =   0   'False
  84.          NumLEDs         =   32
  85.          Orientation     =   1  ' 1 - Vertical
  86.          TabIndex        =   19
  87.          Top             =   330
  88.          Value           =   0
  89.          Width           =   345
  90.       End
  91.       Begin LED LED5 
  92.          AutoSize        =   -1  'True
  93.          BackColor       =   &H00C0C0C0&
  94.          BevelInner      =   0  ' 0 - None
  95.          BevelOuter      =   0  ' 0 - None
  96.          BevelWidth      =   2
  97.          BorderHorizontal=   2
  98.          BorderVertical  =   2
  99.          BorderWidth     =   2
  100.          DecayRate       =   50
  101.          Direction       =   1  ' 1 - Backward
  102.          Height          =   3000
  103.          Index           =   1
  104.          LEDHeight       =   6
  105.          LEDIndex        =   0
  106.          LEDSep          =   0
  107.          LEDStyle        =   0  ' 0 - Rectangular
  108.          LEDWidth        =   15
  109.          Left            =   510
  110.          MaxDecay        =   -1  'True
  111.          Mode            =   0  ' 0 - Value
  112.          MouseControl    =   0   'False
  113.          NumLEDs         =   32
  114.          Orientation     =   1  ' 1 - Vertical
  115.          TabIndex        =   18
  116.          Top             =   330
  117.          Value           =   0
  118.          Width           =   345
  119.       End
  120.       Begin LED LED5 
  121.          AutoSize        =   -1  'True
  122.          BackColor       =   &H00C0C0C0&
  123.          BevelInner      =   0  ' 0 - None
  124.          BevelOuter      =   0  ' 0 - None
  125.          BevelWidth      =   2
  126.          BorderHorizontal=   2
  127.          BorderVertical  =   2
  128.          BorderWidth     =   2
  129.          DecayRate       =   50
  130.          Direction       =   1  ' 1 - Backward
  131.          Height          =   3000
  132.          Index           =   0
  133.          LEDHeight       =   6
  134.          LEDIndex        =   0
  135.          LEDSep          =   0
  136.          LEDStyle        =   0  ' 0 - Rectangular
  137.          LEDWidth        =   15
  138.          Left            =   240
  139.          MaxDecay        =   -1  'True
  140.          Mode            =   0  ' 0 - Value
  141.          MouseControl    =   0   'False
  142.          NumLEDs         =   32
  143.          Orientation     =   1  ' 1 - Vertical
  144.          TabIndex        =   17
  145.          Top             =   330
  146.          Value           =   0
  147.          Width           =   345
  148.       End
  149.    End
  150.    Begin Timer Timer1 
  151.       Interval        =   100
  152.       Left            =   5070
  153.       Top             =   60
  154.    End
  155.    Begin LED LED4 
  156.       AutoSize        =   -1  'True
  157.       BackColor       =   &H00C0C0C0&
  158.       BevelInner      =   0  ' 0 - None
  159.       BevelOuter      =   1  ' 1 - Raised
  160.       BevelWidth      =   2
  161.       BorderHorizontal=   2
  162.       BorderVertical  =   0
  163.       BorderWidth     =   0
  164.       DecayRate       =   0
  165.       Direction       =   0  ' 0 - Forward
  166.       Height          =   480
  167.       LEDHeight       =   28
  168.       LEDIndex        =   0
  169.       LEDSep          =   2
  170.       LEDStyle        =   2  ' 2 - Bitmap
  171.       LEDWidth        =   25
  172.       Left            =   300
  173.       MaxDecay        =   0   'False
  174.       Mode            =   0  ' 0 - Value
  175.       MouseControl    =   -1  'True
  176.       NumLEDs         =   15
  177.       OffPictureGreen =   LEDTEST.FRX:0000
  178.       OffPictureRed   =   LEDTEST.FRX:01CA
  179.       OffPictureYellow=   LEDTEST.FRX:0394
  180.       OnPictureGreen  =   LEDTEST.FRX:055E
  181.       OnPictureRed    =   LEDTEST.FRX:0728
  182.       OnPictureYellow =   LEDTEST.FRX:08F2
  183.       Orientation     =   0  ' 0 - Horizontal
  184.       TabIndex        =   15
  185.       Top             =   3930
  186.       Value           =   0
  187.       Width           =   6165
  188.    End
  189.    Begin LED LED3 
  190.       AutoSize        =   -1  'True
  191.       BackColor       =   &H00C0C0C0&
  192.       BevelInner      =   0  ' 0 - None
  193.       BevelOuter      =   2  ' 2 - Inset
  194.       BevelWidth      =   2
  195.       BorderHorizontal=   0
  196.       BorderVertical  =   2
  197.       BorderWidth     =   2
  198.       DecayRate       =   60
  199.       Direction       =   0  ' 0 - Forward
  200.       Height          =   570
  201.       LEDHeight       =   26
  202.       LEDIndex        =   0
  203.       LEDSep          =   0
  204.       LEDStyle        =   2  ' 2 - Bitmap
  205.       LEDWidth        =   24
  206.       Left            =   60
  207.       MaxDecay        =   0   'False
  208.       Mode            =   0  ' 0 - Value
  209.       MouseControl    =   0   'False
  210.       NumLEDs         =   15
  211.       OffPictureGreen =   LEDTEST.FRX:0ABC
  212.       OffPictureRed   =   LEDTEST.FRX:0C86
  213.       OffPictureYellow=   LEDTEST.FRX:0E50
  214.       OnPictureGreen  =   LEDTEST.FRX:101A
  215.       OnPictureRed    =   LEDTEST.FRX:11E4
  216.       OnPictureYellow =   LEDTEST.FRX:13AE
  217.       Orientation     =   0  ' 0 - Horizontal
  218.       TabIndex        =   14
  219.       Top             =   1110
  220.       Value           =   0
  221.       Width           =   5520
  222.    End
  223.    Begin LED LED1 
  224.       AutoSize        =   0   'False
  225.       BackColor       =   &H00C0C0C0&
  226.       BackgroundPicture=   LEDTEST.FRX:1578
  227.       BevelInner      =   0  ' 0 - None
  228.       BevelOuter      =   1  ' 1 - Raised
  229.       BevelWidth      =   2
  230.       BorderHorizontal=   20
  231.       BorderVertical  =   1
  232.       BorderWidth     =   4
  233.       DecayRate       =   30
  234.       Direction       =   1  ' 1 - Backward
  235.       Height          =   3315
  236.       LEDHeight       =   11
  237.       LEDIndex        =   0
  238.       LEDSep          =   0
  239.       LEDStyle        =   0  ' 0 - Rectangular
  240.       LEDWidth        =   11
  241.       Left            =   5610
  242.       MaxDecay        =   0   'False
  243.       Mode            =   0  ' 0 - Value
  244.       MouseControl    =   0   'False
  245.       NumLEDs         =   15
  246.       Orientation     =   1  ' 1 - Vertical
  247.       TabIndex        =   13
  248.       Top             =   390
  249.       Value           =   0
  250.       Width           =   915
  251.    End
  252.    Begin Frame Frame3 
  253.       BackColor       =   &H00C0C0C0&
  254.       Caption         =   "Direction"
  255.       Height          =   1185
  256.       Left            =   3450
  257.       TabIndex        =   10
  258.       Top             =   2430
  259.       Width           =   1605
  260.       Begin OptionButton Option3 
  261.          BackColor       =   &H00C0C0C0&
  262.          Caption         =   "Backward"
  263.          Height          =   255
  264.          Index           =   1
  265.          Left            =   210
  266.          TabIndex        =   12
  267.          Top             =   630
  268.          Width           =   1245
  269.       End
  270.       Begin OptionButton Option3 
  271.          BackColor       =   &H00C0C0C0&
  272.          Caption         =   "Forward"
  273.          Height          =   255
  274.          Index           =   0
  275.          Left            =   210
  276.          TabIndex        =   11
  277.          Top             =   360
  278.          Width           =   1245
  279.       End
  280.    End
  281.    Begin Frame Frame2 
  282.       BackColor       =   &H00C0C0C0&
  283.       Caption         =   "Mode"
  284.       Height          =   1155
  285.       Left            =   1980
  286.       TabIndex        =   6
  287.       Top             =   2430
  288.       Width           =   1365
  289.       Begin OptionButton Option2 
  290.          BackColor       =   &H00C0C0C0&
  291.          Caption         =   "Bitwise"
  292.          Height          =   195
  293.          Index           =   1
  294.          Left            =   210
  295.          TabIndex        =   8
  296.          Top             =   630
  297.          Width           =   1125
  298.       End
  299.       Begin OptionButton Option2 
  300.          BackColor       =   &H00C0C0C0&
  301.          Caption         =   "Value"
  302.          Height          =   195
  303.          Index           =   0
  304.          Left            =   210
  305.          TabIndex        =   7
  306.          Top             =   390
  307.          Width           =   1065
  308.       End
  309.    End
  310.    Begin Frame Frame1 
  311.       BackColor       =   &H00C0C0C0&
  312.       Caption         =   "LEDStyle"
  313.       Height          =   1155
  314.       Left            =   270
  315.       TabIndex        =   2
  316.       Top             =   2430
  317.       Width           =   1635
  318.       Begin OptionButton Option1 
  319.          BackColor       =   &H00C0C0C0&
  320.          Caption         =   "Bitmap"
  321.          Height          =   225
  322.          Index           =   2
  323.          Left            =   180
  324.          TabIndex        =   5
  325.          Top             =   810
  326.          Width           =   1305
  327.       End
  328.       Begin OptionButton Option1 
  329.          BackColor       =   &H00C0C0C0&
  330.          Caption         =   "Circular"
  331.          Height          =   225
  332.          Index           =   1
  333.          Left            =   180
  334.          TabIndex        =   4
  335.          Top             =   570
  336.          Width           =   1185
  337.       End
  338.       Begin OptionButton Option1 
  339.          BackColor       =   &H00C0C0C0&
  340.          Caption         =   "Rectangle"
  341.          Height          =   225
  342.          Index           =   0
  343.          Left            =   180
  344.          TabIndex        =   3
  345.          Top             =   330
  346.          Width           =   1335
  347.       End
  348.    End
  349.    Begin HScrollBar HScroll1 
  350.       Height          =   255
  351.       Left            =   180
  352.       Max             =   15
  353.       TabIndex        =   1
  354.       Top             =   1770
  355.       Width           =   5325
  356.    End
  357.    Begin LED LED2 
  358.       AutoSize        =   -1  'True
  359.       BackColor       =   &H00C0C0C0&
  360.       BevelInner      =   0  ' 0 - None
  361.       BevelOuter      =   2  ' 2 - Inset
  362.       BevelWidth      =   3
  363.       BorderHorizontal=   10
  364.       BorderVertical  =   2
  365.       BorderWidth     =   2
  366.       DecayRate       =   0
  367.       Direction       =   0  ' 0 - Forward
  368.       Height          =   510
  369.       LEDHeight       =   20
  370.       LEDIndex        =   0
  371.       LEDSep          =   2
  372.       LEDStyle        =   1  ' 1 - Circular
  373.       LEDWidth        =   20
  374.       Left            =   180
  375.       MaxDecay        =   0   'False
  376.       Mode            =   0  ' 0 - Value
  377.       MouseControl    =   0   'False
  378.       NumLEDs         =   15
  379.       Orientation     =   0  ' 0 - Horizontal
  380.       TabIndex        =   0
  381.       Top             =   480
  382.       Value           =   0
  383.       Width           =   5370
  384.    End
  385.    Begin Label Label2 
  386.       Alignment       =   1  'Right Justify
  387.       AutoSize        =   -1  'True
  388.       BackStyle       =   0  'Transparent
  389.       Caption         =   "Current Value:"
  390.       Height          =   195
  391.       Left            =   1200
  392.       TabIndex        =   21
  393.       Top             =   180
  394.       Width           =   1230
  395.    End
  396.    Begin Label Label1 
  397.       Caption         =   "Label1"
  398.       Height          =   165
  399.       Left            =   2490
  400.       TabIndex        =   9
  401.       Top             =   210
  402.       Width           =   1485
  403.    End
  404. End
  405.  
  406. Dim theta(5) As Single
  407. Dim rates(5) As Single
  408.  
  409. Sub Command1_Click ()
  410.  
  411.     On Error Resume Next
  412.  
  413.     i = Shell("winhelp instrum.hlp", 1)
  414.  
  415. End Sub
  416.  
  417. Sub Form_Load ()
  418.  
  419.     Randomize
  420.     For i = 0 To 4
  421.         theta(i) = Rnd(1) * 3.14159
  422.         rates(i) = .2 * Rnd(1)
  423.     Next
  424.  
  425.     For i = 0 To 8
  426.         led1.LEDIndex = i
  427.         led1.LEDColor = 2
  428.         led2.LEDIndex = i
  429.         led2.LEDColor = 2
  430.         led3.LEDIndex = i
  431.         led3.LEDColor = 2
  432.         led4.LEDIndex = i
  433.         led4.LEDColor = 2
  434.     Next
  435.  
  436.     For i = 9 To 12
  437.         led1.LEDIndex = i
  438.         led1.LEDColor = 1
  439.         led2.LEDIndex = i
  440.         led2.LEDColor = 1
  441.         led3.LEDIndex = i
  442.         led3.LEDColor = 1
  443.         led4.LEDIndex = i
  444.         led4.LEDColor = 1
  445.     Next
  446.  
  447.     For i = 13 To 15
  448.         led1.LEDIndex = i
  449.         led1.LEDColor = 0
  450.         led2.LEDIndex = i
  451.         led2.LEDColor = 0
  452.         led3.LEDIndex = i
  453.         led3.LEDColor = 0
  454.         led4.LEDIndex = i
  455.         led4.LEDColor = 0
  456.     Next
  457.  
  458.     label1 = ""
  459.  
  460. End Sub
  461.  
  462. Sub HScroll1_Change ()
  463.  
  464.     led1.Value = Hscroll1
  465.     led2.Value = Hscroll1
  466.     led3.Value = Hscroll1
  467.     led4.Value = Hscroll1
  468.  
  469.     label1 = led2.Value
  470.  
  471.  
  472. End Sub
  473.  
  474. Sub HScroll1_Scroll ()
  475.  
  476.     led1.Value = Hscroll1
  477.     led2.Value = Hscroll1
  478.     led3.Value = Hscroll1
  479.     led4.Value = Hscroll1
  480.  
  481.     label1 = led2.Value
  482.  
  483. End Sub
  484.  
  485. Sub LED4_Click ()
  486.  
  487.     If led4.Value <= Hscroll1.Max Then
  488.         Hscroll1 = led4.Value
  489.     Else
  490.         label1 = led4.Value
  491.     End If
  492.  
  493. End Sub
  494.  
  495. Sub Option1_Click (index As Integer)
  496.  
  497.     led4.LEDStyle = index
  498.  
  499. End Sub
  500.  
  501. Sub Option2_Click (index As Integer)
  502.  
  503.     led4.Mode = index
  504.     If index = 1 Then
  505.         j = led4.NumLEDs - 1
  506.         If j > 31 Then j = 31
  507.  
  508.     End If
  509.  
  510. End Sub
  511.  
  512. Sub Option3_Click (index As Integer)
  513.  
  514.     led4.Direction = index
  515.  
  516. End Sub
  517.  
  518. Sub Timer1_Timer ()
  519.  
  520.     For i = 0 To 3
  521.         Randomize
  522.         led5(i) = 32 * Sin(theta(i)) ^ 2
  523.         theta(i) = theta(i) + rates(i)
  524.     Next
  525.  
  526. End Sub
  527.  
  528.